package com.example.class_manage.Mapper;

import com.example.class_manage.Entity.Howework_pic;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.sql.Blob;
import java.util.List;


@Mapper
public interface HomeWork_pic_mapper {
    @Select("select * from homework_pic where stu_id = #{stu_id}")
    public List<Howework_pic> Find_All_bystu_id_photoHomework(String stu_id);

    @Select("select * from homework_pic")
    public List<Howework_pic> Find_AllHomework();

    @Insert("insert into homework_pic(id,student_name,Homework_img,Time,stu_id,Flag) values (#{id},#{student_name},#{Homework_img},#{Time},#{stu_id},#{Flag})  ")
    public Integer Insert_onerecord(String id,String student_name,byte Homework_img[],String Time,String stu_id,String Flag);

    @Update("update homework_pic set appraise=#{appraise},grade=#{grade} where id = #{id}")
    public Integer Upappraise(String appraise,String grade,String id);

    @Select("select * from homework_pic where id = #{id}")
    public List<Howework_pic> Find_All_byid_photoHomework(String id);

    @Insert("insert into question_pic(id, `describe`,pic) values (#{id},#{descibe},#{Question_img})")
    Integer UploadQuestion(String id,String descibe,byte Question_img[]);//上传作业

    @Select("select * from homework_pic where Id = #{id}")
    List<Howework_pic> Get_Class_HomeWork_pic(String id);

    @Select("select homework_img from homework_pic where id = 123124")
    byte[] Test();

    @Select("select * from homework_pic where stu_id = #{id}")
    List<Howework_pic> Review_All_pic_bystu_id(String id);

    @Select("select * from homework_pic where Flag = 1 and stu_id = #{id}")
    List<Howework_pic> Review_pic_byFlag(String id);

    @Update("update homework_pic set flag = #{flag} where stu_id = #{stu_id} and id = #{id}")
    Integer Update_flag(String flag, String stu_id, String id);

    @Select("select * from homework_pic where mark_flag = #{mark_flag}")
    List<Howework_pic> Review_All_pic_bymark_flag(String mark_flag);

    @Select("select * from homework_pic where mark_flag = 1")
    List<Howework_pic> Review_All_pic_bymark_flag_teacher();

    @Select("select * from homework_pic where mark_flag = 2 and id = #{id}")
    List<Howework_pic> Review_All_pic_bymark_flag_assistant(String id);

    //设置批阅方式
    @Update("update homework_pic set mark_flag = #{mark_flag} where id = #{id}")
    Integer UpHomework_pic_mark(String mark_flag, String id);



}
